package cn.lingyangwl.agile.infra.dict.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.lingyangwl.agile.file.excel.ExcelUnique;
import cn.lingyangwl.agile.model.ExcelBaseModel;
import cn.lingyangwl.agile.model.constants.ValidationCons;
import cn.lingyangwl.agile.model.module.dict.DictTypeCons;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

/**
 * 字典数据表 sys_dict
 * 
 * @author shenguangyang
 */
@Getter
@Setter
public class DictItemExcel extends ExcelBaseModel {
    private static final long serialVersionUID = 1L;

    /**
     * 字典编码
     */
    @Excel(name = "字典编码", orderNum = "1", width = 25)
    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    @ExcelUnique
    private String dictCode;

    /**
     * 字典名称
     */
    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    @Excel(name = "字典名称", orderNum = "5", width = 25)
    @Size(min = 1, max = 100, message = "字典名称长度不能超过100个字符")
    private String dictName;

    /**
     * 字典子集名称
     */
    @Excel(name = "字典子集名称", orderNum = "10", width = 25)
    @NotBlank(message = ValidationCons.NOT_EMPTY)
    @Size(min = 0, max = 100, message = "字典子集名称长度不能超过100个字符")
    private String itemLabel;

    @Excel(name = "字典子集值", orderNum = "15", width = 25)
    @NotBlank(message = ValidationCons.NOT_EMPTY)
    @Size(min = 0, max = 100, message = "字典子集值长度不能超过100个字符")
    @JsonProperty("value")
    @ExcelUnique
    private String itemValue;

    /**
     * 字典排序
     */
    @Excel(name = "字典排序", orderNum = "20", width = 16)
    private Long sortNo = 1L;

    /**
     * 默认（Y是 N否）
     */
    @Excel(name = "默认", orderNum = "25", replace = {"是_Y", "否_N"}, addressList = true, width = 16)
    private String isDefault;

    /**
     * 状态（1正常 2停用）
     */
    @Excel(name = "状态", dict = DictTypeCons.DICT_ITEM_STATUS, addressList = true, orderNum = "30", width = 16)
    private String status;
}
